#include<stdio.h>
#include<string.h>
void insert(char s1[],char s2[],char ch)
{
	int i,n=0;
	int g,j,m;
	for(j=0;s1[j]!='\0';j++);
	for(g=0;s2[g]!='\0';g++);
	for(i=0;s1[i]!='\0';i++)
	{
		if(s1[i]==ch)
	   {
	   	 n=1;
	     break;
	   }
	}
	int b,d,e=j;

	if(n==0)
	for(b=0;s2[b]!='\0';b++,d++)
	s1[d]=s2[b];
	else
	{
		for(m=i+g-1;m>i+g;m--,j--)
		s1[m]=s1[j-1];
		for(b=0;s2[b]!='\0';i++,b++)
		s1[i+1]=s2[b];
		/*for(m=i+g-1;m>g+i;m--,j--)
		s1[m]=s1[j-1];
		for(b=0;s2[b]!='\0';i++,b++)
		s1[i+1]=s2[b];*/
	}
    s1[e+g+1]=0;
}
int main()
{
	char s1[128],s2[128],ch;
	gets(s1);
	gets(s2);
	scanf("%c",&ch);
	insert(s1,s2,ch);
	puts(s1);
	return 0;
}
